<!--
 * @Author: MiNine
 * @Date: 2020-09-21 11:13:59
 * @LastEditors: 岸舟
 * @LastEditTime: 2020-09-23 20:22:42
 * @Description: 
-->
<template>
  <div class="myAside">
    <el-menu
      default-active="1-4-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
      background-color="#7B90D2"
      text-color="#fff"
      active-text-color="#ffd04b"
      :router="true"
    >
      <div class="asideTitle">
        <!-- <span v-show="!isCollapse">蜗牛租车</span>
        <span v-show="isCollapse">WNZC</span> -->
        <img src="../../assets/img/public/logo_text.png" class="aside-logo" alt="" />
      </div>
      <!-- <el-submenu index="1" v-if="vIf['onlyAdmin']"> -->
      <el-submenu index="1" style="margin-top: 40px">
        <template slot="title">
          <i class="el-icon-user whiteicon"></i>
          <span slot="title">管理员管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item
            index="/system/admin/addadmin"
            v-if="role === '超级管理员'"
            >新增管理员</el-menu-item
          >
          <el-menu-item index="/system/admin/adminList"
            >管理员列表</el-menu-item
          >
        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-s-custom whiteicon"></i>
          <span slot="title">用户管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/system/user/adduser" 
            >添加用户</el-menu-item
          >
          <el-menu-item index="/system/user/userlist">用户列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-tickets whiteicon"></i>
          <span slot="title">订单管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/system/order/addorder">添加订单</el-menu-item>
          <el-menu-item index="/system/order/OrderList">订单列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-truck whiteicon"></i>
          <span slot="title">车辆管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/system/car/addcar">添加车辆</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group>
          <el-menu-item index="/system/car/carlist">车辆列表</el-menu-item>
        </el-menu-item-group>
      
      </el-submenu>
      <el-submenu index="5">
        <template slot="title">
          <i class="el-icon-document-copy"></i>
          <span slot="title">评价管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/system/customercomme/addcarcoments">用户评价</el-menu-item>
        </el-menu-item-group>
         <el-menu-item-group>
          <el-menu-item index="/system/carcomemnts/addcarcoments">车辆评价</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
       <el-submenu index="6">
        <template slot="title">
          <i class="el-icon-document-copy"></i>
          <span slot="title">现状图</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/system/lineargraph/addlineargraph">线状图</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";

const { mapState } = createNamespacedHelpers("publicStore");

export default {
  data() {
    return {
      vIf: {
        onlyAdmin: ["1", "9"].some((item) => item == sessionStorage.permission),
      },
      role: "超级管理员",
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    },
  },
  computed: {
    ...mapState(["isCollapse"]),
  },
  created() {
    const userInfo = JSON.parse(localStorage.getItem("userInfo"));
    // console.log(userInfo);
    const { role } = userInfo;
    this.role = role;
  },
};
</script>

<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}

.el-menu {
  border-right: none !important;
}
.whiteicon {
  color: white !important;
}

@import "../../assets/scss/public/myAside.scss";
@import "../../element-variables.scss";
</style>
